package com.azier.kapacitor.script.node;

import com.azier.kapacitor.script.arg.Arg;
import com.azier.kapacitor.script.method.As;
import com.azier.kapacitor.script.method.Quiet;
import com.azier.kapacitor.script.method.UsePointTimes;
import com.azier.kapacitor.script.node.nodebind.CommonNodeBind;

import java.util.ArrayList;
import java.util.List;

/**
* 1 * @Author: luoj
* 2 * @Date: 2019/11/8 11:27
* 3
*/

/**
Has no constructor signature.
**/
/**
没有构造函数签名。
**/
public abstract class AbstractInfluxQLNode extends AbstractNode implements CommonNodeBind {
    private static final String name = "influxQL";

    public AbstractInfluxQLNode(List<Arg> args,String name) {
        super(args,new ArrayList<>(),name);
    }

    /**
    The name of the field, defaults to the name of function used (i.e. .mean -> ‘mean’)
    **/
    /**
    字段名称，默认为所用函数的名称（即.mean->“ mean”）
    **/
    public AbstractInfluxQLNode as(String influxQL){
        As as = new As(influxQL);
        super.addMethod(as);
        return this;
    }
    /**
    Suppress all error logging events from this node.
    **/
    /**
    禁止来自此节点的所有错误记录事件。
    **/
    public AbstractInfluxQLNode quiet(){
        Quiet quiet = new Quiet();
        super.addMethod(quiet);
        return this;
    }
    /**
    Use the time of the selected point instead of the time of the batch.
    **/
    /**
    使用选定点的时间而不是批次的时间。
    **/
    public AbstractInfluxQLNode usePointTimes(){
        UsePointTimes usePointTimes = new UsePointTimes();
        super.addMethod(usePointTimes);
        return this;
    }
}